<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="${pageContext.request.contextPath }/">
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/register.js"></script>
<title>Insert title here</title>
<style>
.inputstyle1 { 
	width: 280px;
	height: 20px;
	border: 1px solid gray;
}
body {
	font-size: 14px;
}
</style>
<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="153" height="48"><img src="images/groupmanagerlogo.gif" width="153" height="48"></td>
                <td background="images/maintitle-bg.gif">&nbsp;</td>
                <td width="80"><img src="images/maintitle-right.gif" width="80" height="48"></td>
              </tr>
</table>
	<div style="width: 800px; margin: 10px auto; color: #F00">
		
	</div>
	<form action="registerServlet" method="post" name="form1" onsubmit="return ck()">
		<table style="background-color: #999" width="800" border="0"
			align="center" cellpadding="3" cellspacing="1">
			<caption>用户注册</caption>
			<tr>
				<td width="200" height="40" align="right" bgcolor="#F5F5F5">用户名：</td>
				<td width="300" bgcolor="#F5F5F5"><label for="userName"></label>
					<input name="userName" type="text" class="inputstyle1"
					id="userName"  value="${model.username }" onblur="checkName()" onfocus="$('#success').text('')"></td>
				<td bgcolor="#F5F5F5" style="color:red;" id="tdUsername">
				   <c:forEach items="${list }" var="item">
				       <c:if test="${item eq '1'}">*用户名不能为空</c:if>
				       <c:if test="${item eq '2'}">*用户名长度不符(6~18)</c:if>
				       <c:if test="${item eq '6'}">*该用户名已经被注册了</c:if>
				   </c:forEach>
				</td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">密 码：</td>
				<td bgcolor="#F5F5F5"><input name="userPass" type="password"
					class="inputstyle1" id="userPass" value="${model.userpass }" onblur="checkPass()"></td>
				<td bgcolor="#F5F5F5" style="color:red;" id="tdUserpass">
				   <c:forEach items="${list }" var="item">
				       <c:if test="${item eq '3'}">*密码不能为空</c:if>
				       <c:if test="${item eq '4'}">*密码长度不符(6~18)</c:if>
				       <c:if test="${item eq '5'}">*密码不能是纯数字的,只能是数字和字符的组合</c:if>
				   </c:forEach>
				</td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">真实姓名：</td>
				<td bgcolor="#F5F5F5"><input name="userTrueName" type="text"
					class="inputstyle1" id="userTrueName" value="${model.truename }"></td>
				<td bgcolor="#F5F5F5" style="color:red;"></td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">年 龄：</td>
				<td bgcolor="#F5F5F5"><input name="age" type="number"
					class="inputstyle1" id="age" max="130" min="18" 
					<c:choose>
						<c:when test="${empty model.age}">value="18"</c:when>
						<c:otherwise>value="${model.age}"</c:otherwise>
					</c:choose>
					></td>
				<td bgcolor="#F5F5F5" style="color:red;">&nbsp;</td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">性 别：</td>
				<td bgcolor="#F5F5F5"><input type="radio" name="gender" 
					value="男" checked="checked">男&nbsp;&nbsp; <input type="radio" name="gender"
					value="女" <c:if test="${model.gender eq '女' }">checked="checked"</c:if> >女</td>
				<td bgcolor="#F5F5F5" style="color:red;">&nbsp;</td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">爱 好：</td>
				<td bgcolor="#F5F5F5"><input type="checkbox" name="favorite"
					value="打篮球" 
					<c:forEach items="${favorite}" var="item">
						<c:if test="${item eq '打篮球'}">checked="checked"</c:if>
					</c:forEach>
					> 打篮球 <input type="checkbox" name="favorite"
					value="提篮球"  
					<c:forEach items="${favorite}" var="item">
						<c:if test="${item eq '提篮球'}">checked="checked"</c:if>
					</c:forEach>
					> 提篮球 <input type="checkbox" name="favorite"
					value="玩篮球"
					<c:forEach items="${favorite}" var="item">
						<c:if test="${item eq '玩篮球'}">checked="checked"</c:if>
					</c:forEach>
					> 玩篮球 <input type="checkbox" name="favorite"
					value="拍篮球"
					<c:forEach items="${favorite}" var="item">
						<c:if test="${item eq '拍篮球'}">checked="checked"</c:if>
					</c:forEach>
					> 拍篮球</td>
				<td bgcolor="#F5F5F5" style="color:red;">&nbsp;</td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">电话：</td>
				<td bgcolor="#F5F5F5"><input 
					name="phone" type="tel" class="inputstyle1" id="phone" value="${model.phone }"></td>
				<td bgcolor="#F5F5F5" style="color:red;">&nbsp;</td>
			</tr>
			<tr>
				<td height="40" align="right" bgcolor="#F5F5F5">地址：</td>
				<td bgcolor="#F5F5F5"><input 
					name="address" type="text" class="inputstyle1" id="address" value="${model.address }"></td>
				<td bgcolor="#F5F5F5" style="color:red;">&nbsp;</td>
			</tr>
			<tr>
				<td bgcolor="#F5F5F5" style="color:red;" id="success">
				<c:forEach items="${list }" var="item">
						<c:if test="${item eq '7'}">*向数据库中添加数据出错了</c:if>
						<c:if test="${item eq '8'}">*注册成功</c:if>
				</c:forEach>
				</td>
				<td height="40" colspan="2" bgcolor="#F5F5F5"><input
					type="submit" name="button" id="button" value="保   存">
					&nbsp;&nbsp;  <input name="button"
						type="button" class="submitbutton" onclick="location.href='userlistServlet'"
						value="返    回" /> 
				</td>
			</tr>
		</table>
	</form>
	<br />
</body>
</html>